﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="dashboard.aspx.cs" Inherits="RastinArgham.CRM.Web.dashboard" %>
<%@ Import Namespace="Mani.Common" %>
<%@ Register Assembly="Mani.Common" Namespace="Mani.Common" TagPrefix="mani" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
   
   <h3 class="ui-widget-header">داشبورد</h3>

   <div class="ui-layout-content ui-widget-content">

      <div>
        شهر : 
        &nbsp;
        <asp:DropDownList ID="ddlCities" DataTextField="CityName" DataValueField="CityId" 
              AutoPostBack="true" runat="server" AppendDataBoundItems="true" 
              onselectedindexchanged="ddlCities_SelectedIndexChanged">
            <asp:ListItem Text="همه شهرها" Value="-1" />
        </asp:DropDownList>
      </div>

      <div class="space2"></div>

      <div>
        آمار وضعیت سرویس ها : 
        
        <div class="space2"></div>

        <asp:Repeater ID="rptStats" runat="server">
            <ItemTemplate>
              <span>
               <a href='dashboard.aspx?stateId=<%# Eval("Status") %>' class='<%# CheckNotification(Eval("Status")) %>'>
                <%# Eval("StateName") %> 
                (
                <%# Eval("Count") %>
                )
               </a>
              </span>
              &nbsp; &nbsp;
            </ItemTemplate>
        </asp:Repeater>
     </div>

     <div class="space2"></div>

     <div>
        
        <mani:PagingGridView ID="gvOrders" runat="server" AutoGenerateColumns="false" 
            GridLines="None" DataKeyNames="OrderId" AllowPaging="true" 
            PageSize="25" onrowcommand="gvOrders_RowCommand" ViewStateMode="Enabled"
            onrowdatabound="gvOrders_RowDataBound" VirtualItemCount="-1"
             onpageindexchanging="gvOrders_PageIndexChanging" >
            <Columns>
                <asp:BoundField HeaderText="کد" DataField="OrderId" />
                <asp:TemplateField HeaderText="عنوان شخص">
                    <ItemTemplate>
                        <a href='<%# Eval("ContactEditLink") %>'>
                            <%# Eval("ContactTitle") %>
                        </a>
                    </ItemTemplate>
                </asp:TemplateField>
                
                <asp:TemplateField HeaderText="سرویس">
                    <ItemTemplate>
                      <a href='order_services.aspx?id=<%# Eval("ContactId") %>&OrderId=<%# Eval("OrderId") %>'>
                        <%# Eval("ServiceName") %>
                      </a>
                    </ItemTemplate>
                </asp:TemplateField>

                <asp:TemplateField HeaderText="کالاها">
                    <ItemTemplate>
                      <a href='order_product.aspx?id=<%# Eval("ContactId") %>'>
                        لیست کالاها
                      </a>
                    </ItemTemplate>
                </asp:TemplateField>
                
                <asp:TemplateField HeaderText="شناسه کاربری">
                    <ItemTemplate>
                        <%# Eval("SubID") %>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="انقضای سرویس">
                    <ItemTemplate>
                        <%# Convert.ToDateTime(Eval("ServiceExpirationDate")).ToJalali()%>
                    </ItemTemplate>
                </asp:TemplateField>

                <asp:TemplateField HeaderText="مبلغ کل ( ریال )">
                    <ItemTemplate>
                        <%# UIHelper.FormatString(Eval("TotalPrice")) %>
                    </ItemTemplate>
                </asp:TemplateField>

                <asp:BoundField HeaderText="وضعیت" DataField="Status" />
                <asp:BoundField HeaderText="توضیحات" DataField="LastComment" />
                <asp:BoundField HeaderText="نام مسئول" DataField="AccountManagerName" />
                <asp:BoundField HeaderText="آخرین اپرتور" DataField="OperatorName" />

                <asp:TemplateField HeaderText="عملیات">
                    <ItemTemplate>
                        <asp:LinkButton ID="lbLink1" Visible="false" runat="server" />
                        <asp:LinkButton ID="lbLink2" Visible="false" runat="server" />
                        <asp:LinkButton ID="lbLink3" Visible="false" runat="server" />
                        <asp:LinkButton ID="lbLink4" Visible="false" runat="server" />
                    </ItemTemplate>
                </asp:TemplateField>
           </Columns>
        </mani:PagingGridView>


     </div>
   </div>
</asp:Content>
